<include file="Public/header"/>
<div class="row">
    <div class="wrapper wrapper-content animated">
        <div class="ibox-content">
            <div class="deal-bd order-bottom">API开发文档</div>
        </div>
        <div class="tablediv">
            <div style="padding: 20px; background-color: #F2F2F2;">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header">API对接参数：</div>
                            <div class="layui-card-body">
                                商户号：<{$fans['uid']+10000}><br>
                                网关地址：http://47.88.230.133/gateway<br>
                                APIKEY: <button id="apikey-query" onclick="apikey(this)" data-mobile="<{$mobile}>" class="btn btn-primary">查看密钥</button><span id='apikey' class="hide"></span>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header">对接Demo下载</div>
                            <div class="layui-card-body">
                                <a href="http://47.88.223.245/demo.html">API文档及示例.</a><br>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="Public/footer"/>
</body>
<script>
    var apikey;
    var index;
    layui.use('layer', function(layer){
        apikey = function (obj) {
            index = layer.prompt({
                        formType: 1,
                        title: '请输入支付密码',
                        close: false,
                        btn: ['确定','取消']
                    }, function (value){
                        if(!value){
                            layer.msg('请输入支付密码', {icon: 5});
                            return false;
                        }
                        show(value)
                    });
        };
    });
    

    function show(code){
        var data = {};
        if(code){
            data = {code:code};
        }
        $.ajax({
            url:"<{:U('User/Channel/Apikey')}>",
            type:"post",
            data: data,
            success:function(res){
                if(res.status){
                    $('#apikey-query').hide();
                    $('#apikey').text(res.apikey).removeClass('hide')
                    layer.close(index);
                }else {
                    layer.msg(res.msg, {icon: 5});
                    return false;
                }
            }
        });
    }
</script>
</html>